package base.day22.stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class MyStream6 {
    public static void main(String[] args) {
        ArrayList<Integer> list=new ArrayList<>();
        for (int i = 1; i < 10; i++) {
            list.add(i);
        }
        //tolist
        List<Integer> list1 = list.stream().filter(i -> i % 2 == 0).collect(Collectors.toList());
        System.out.println(list1);
        //toset
        Set<Integer> set = list.stream().filter(i -> i % 2 == 0).collect(Collectors.toSet());
        System.out.println(set);

    }
}
